import java.util.HashMap;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    private static final int N = 35;

    private static int n, m, tn;
    private static int[] w = new int[N];
    private static int res = 50;
    private static HashMap<Integer, Integer> h = new HashMap<>();

    public static void dfs_1(int u, long s, int cnt) {
        if (s > m) {
            return;
        }
        if (u == tn) {
            h.put((int)s, h.getOrDefault((int)s, cnt));
            return;
        }

        dfs_1(u + 1, s, cnt);
        dfs_1(u + 1, s + w[u] / 2, cnt + 1);
        dfs_1(u + 1, s + w[u], cnt);
    }

    public static void dfs_2(int u, long s, int cnt) {
        if (s > m || cnt > res) {
            return;
        }
        if (u == n) {
            if (h.containsKey((int)(m - s))) {
                res = Math.min(res, h.get((int)(m - s)) + cnt);
            }
            return;
        }

        dfs_2(u + 1, s, cnt);
        dfs_2(u + 1, s + w[u] / 2, cnt + 1);
        dfs_2(u + 1, s + w[u], cnt);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        n = in.nextInt();
        m = in.nextInt();
        m *= 2;

        for (int i = 0; i < n; ++i) {
            w[i] = in.nextInt();
            w[i] *= 2;
        }

        Arrays.sort(w, 0, n);

        tn = Math.max(0, n / 2 - 2);

        dfs_1(0, 0, 0);
        dfs_2(tn, 0, 0);

        System.out.println((res == 50 ? -1 : res));
    }
}